export function merge(obj1, obj2) {
  const obj = {}
  for(let key of Object.keys(obj1)) {
    if(obj1.hasOwnProperty(key)) {
      obj[key] = obj1[key]
    }
  }
  for(let key of Object.keys(obj2)) {
    if(obj2.hasOwnProperty(key)) {
      obj[key] = obj2[key]
    }
  }
  return obj
}

export function filterProperties(before, filters = [], filterOnly = false) {
  const after = {}
  for(let key of Object.keys(before)) {
    if(before.hasOwnProperty(key)) {
      if(filterOnly && filters.includes(key)) {
        after[key] = before[key]
      } else if(!filterOnly && !filters.includes(key)){
        after[key] = before[key]
      }
    }
  }
  return after
}